//user/pass 759704114/Zbpkp9K0zl3zvzQn
var mongoose=require('mongoose');
/**
 * 配置 MongoDb options
 */
function getMongodbConfig() {
    let options = {
        //useNewUrlParser: true,
        minPoolSize: 1,
        maxPoolSize: 5, // 连接池中维护的连接数
        //reconnectTries: Number.MAX_VALUE,
        keepAlive: true,
        keepAliveInitialDelay:120
        
    }
    return options;
}
function connect(){
    mongoose.connect('mongodb+srv://759704114:Zbpkp9K0zl3zvzQn@cluster0.qgq3tmh.mongodb.net/test',getMongodbConfig());
    mongoose.connection
    .on('error',console.log)
    .on('disconnected',connect)
    .on('open',function(){
        console.log('mongoose open')
    });

}
module.exports=connect();
